﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;

namespace Data
{
    internal class Query : DBOperation
    {
        public Query(string statement, List<MySqlParameter> parameters) : base(statement, parameters) { }

        public DataTable Execute()
        {
            Bind();
            DataTable t = new DataTable();

            try
            {
                Command.Connection.Open();
                MySqlDataAdapter a = new MySqlDataAdapter(Command);
                a.Fill(t);
                Command.Connection.Close();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return t;
        }
    }
}
